
export type IEventType =
  'app.init' |
  'win.restore' | 'win.maximize' | 'win.minimize' | 'win.resize' | 'win.updated' |
  'menus.clean' | 'menus.selected' |
  'folder.load' | 'folder.open' |
  'editor.open' | 'editor.active' | 'editor.save' | 'editor.close' | 'editor.changed' |
  'editor.cursorChanged' |
  'frame.left.resize' | 'frame.left.beginResize' | 'frame.left.endResize'
;

export interface IEvent {
  type: IEventType;
  data?: any;
}

export interface IWindowState {
  width: number;
  height: number;
  isMinimize: boolean;
  isMaximize: boolean;
}


export interface IMenu {
  id: string;
  text: string;
  command?: string;
  children?: IMenu[];
}

export interface IMenusState {
  menus: IMenu[];
  selectedMenus: IMenu[];
}

export interface IFile {
  filePath: string;
  name: string;
  isLoaded: boolean;
  isFolder: boolean;
  children: IFile[];
  content: string;
}

export interface IFilesState {
  folders: IFile[];
}

export interface IEditor {
  id: string;
  filePath: string;
  originContent: string;
  content: string;
  lang: string;
  fileName: string;
  extName: string;
  cursor: {
    rowNo: number;
    colNo: number;
  };
  selected: number;
}

export interface IEditorsState {
  editors: IEditor[];
  activeId: string;
}

export interface IFrameState {
  leftWidth: number;
  virtualLeftWidth: number;
}

export interface IAppState {
  windowState: IWindowState;
  menusState: IMenusState;
  filesState: IFilesState;
  editorsState: IEditorsState;
  frameState: IFrameState;
}
